﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;

namespace WEALTH
{
    public partial class MemberRegister : ClientBasePage
    {
        public string strEmail = string.Empty;     

        protected void Page_Load(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(Request.QueryString["p"]))
            {
                Response.Redirect("index.aspx");
            }
            if (!string.IsNullOrEmpty(Request.QueryString["mail"]))
            {
                strEmail = Request.QueryString["mail"].ToString();
            }             
        }
        /// <summary>
        /// 验证码提交检查
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void But_Next_Click(object sender, EventArgs e)
        {
            // ExcuteDao dao1 = new ExcuteDao();

            //string strvailecode1 = dao1.Get_VAILECODE("123");
            //int asss = dao1.Update_MemberStatus("123", true);

            if (!string.IsNullOrEmpty(Request.QueryString["p"]))
            {
                ExcuteDao dao = new ExcuteDao();
                string strvailecode = dao.Get_VAILECODE(AppFunction.Decrypt(Request.QueryString["p"]));
                if (strvailecode.Length > 0)
                {
                    if (!strvailecode.Equals(txt_ActivationCode.Text))
                    {
                        ShowMsg("验证码不正确，请确认或联系客服！", 1);
                        txt_ActivationCode.Focus();
                        return;
                    }
                    if (dao.Update_MemberStatus(AppFunction.Decrypt(Request.QueryString["p"]), true) > 0)
                    {
                        MemberCurrent currentMember = new MemberCurrent();
                        currentMember = (MemberCurrent)Session[SessionKeys.REG_MEMBER];
                        currentMember.M_Status = true;
                        Session[SessionKeys.CURRENT_MEMBER] = currentMember;
                        ShowMsg("恭喜你，注册成功！",0);
                        Response.Redirect("MemberDetail.aspx", true);
                    }
                }
            }
        }
    }
}
